#include <REGX52.H>
#include "LCD1602.h"
#include "DS18B20.h"
#include "OneWire.h"
#include "DS18B20.h"


void main()
{
	float T = 0.0;
	DS18B20_ConvertT();
	LCD_Init();
	LCD_ShowString(1,1,"WenDu");
	while(1)
	{
		DS18B20_ConvertT();
		T=DS18B20_RadT();
		if(T<0)
		{
			LCD_ShowChar(2,1,'-');
			T=-T;
		}
		else if(T>0)
		{
			LCD_ShowChar(2,1,'+');
		}
		//LCD只能显示整数浮点数自动被强制类型转换成int丢失小数部分
		LCD_ShowNum(2,2,T,3);
		LCD_ShowChar(2,5,'.');
		//显示小数部分
		LCD_ShowNum(2,6,((unsigned long)(T*10000))%10000,4);
	}
}